package com.amkor.web.myhome.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.amkor.web.common.dao.BeanManager;
import com.amkor.web.myhome.service.EvaluationService;

public class MyhomeAjaxAction extends Action{
	
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {		
		ActionForward forward = new ActionForward();
		
		String ret = "";
		// ApplicationContext ctx = null;
		try{
			// ctx = (EvaluationService)BeanManager.getAppCtx().getBean("evaluationService", EvaluationService.class);
			// ctx = new GenericXmlApplicationContext("/com/amkor/web/common/resource/WebAppCtx_PROD.xml");
			// EvaluationService evalService = (EvaluationService)ctx.getBean("evaluationService", EvaluationService.class);

			EvaluationService evalService = 
					(EvaluationService)BeanManager.getAppCtx().getBean("evaluationService", EvaluationService.class);
						
			ret = (String)evalService.getEvaluationRating(346012, 11107, 11401);
												
	  }catch (Exception e) {
			e.printStackTrace();			
		}finally{
			request.setAttribute("json", ret);	
			forward = mapping.findForward("success");
		}	
		return (forward);
	}

}
